package com.reebake.ideal.system.controller;

import cn.hutool.core.bean.BeanUtil;
import com.reebake.ideal.system.entity.Notice;
import com.reebake.ideal.system.service.NoticePlusService;
import com.reebake.ideal.system.vo.NoticeContentVO;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("notice")
@RequiredArgsConstructor
public class NoticePlusController {
    private final NoticePlusService noticePlusService;

    @PostMapping("save-with-content")
    public void saveWithContent(@RequestBody NoticeContentVO noticeContentVO){
        noticePlusService.save(BeanUtil.copyProperties(noticeContentVO, Notice.class), noticeContentVO.getContent());

    }
}
